import javax.swing.JOptionPane;

public class YoungOrOld {

	public static void main(String[] args) {

		if (args.length == 0) {
			String username = JOptionPane.showInputDialog("Enter name:");
			String surname = JOptionPane.showInputDialog("Enter surname:");
			String age = JOptionPane.showInputDialog("Enter age:");

			if (Integer.parseInt(age) > 40) {
				JOptionPane.showMessageDialog(null, "Welcome: " + username
						+ " " + surname + ". Oppss... You are old!");
			} else
				JOptionPane.showMessageDialog(null, "Welcome: " + username
						+ " " + surname + ". You are still young!");
		}

		else {
			if (args.length == 3) {
				if (Integer.parseInt(args[2]) > 40) {
					JOptionPane.showMessageDialog(null, "Welcome: " + args[0]
							+ " " + args[1] + ". Oppss... You are old!");
				} else
					JOptionPane.showMessageDialog(null, "Welcome: " + args[0]
							+ " " + args[1] + ". You are still young!");

			} else {
				JOptionPane.showMessageDialog(null,
						"You screwed it up! \n Run with three arguments! ");
			}

		}

	}
}
